#ifndef INPUTSELECTOR_H
#define INPUTSELECTOR_H

#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>

#include "dynamicarray.h"

struct s_InputSelector
{
    fd_set rfds;
    struct timeval delay;
    DynamicArray filedescriptors;
    pthread_mutex_t mutex;
} typedef InputSelector;

void inputSelector_create(InputSelector** inputSelector);

void inputSelector_initialize(InputSelector *inputSelector);

void inputSelector_clear(InputSelector* inputSelector);

void inputSelector_destroy(InputSelector** inputSelector);

void inputSelector_add(InputSelector* inputSelector, int fileDescriptor);

int inputSelector_remove(InputSelector* inputSelector, int fileDescriptor);

int inputSelector_selectAndRemove(InputSelector* inputSelector, int* fileDescriptor);

int inputSelector_isReadable(InputSelector* inputSelector, int fileDesciptor);

#endif
